@import "tailwindcss";
@import "./swup-transitions.css";

/* 定义深色模式选择器 */
@custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *));

@theme {
  /* 主色调 - 使用更现代的蓝紫色 */
  --color-primary-50: #f5f7ff;
  --color-primary-100: #ebf0ff;
  --color-primary-200: #d6e0ff;
  --color-primary-300: #adc2ff;
  --color-primary-400: #839dff;
  --color-primary-500: #4b6bff;
  --color-primary-600: #3451db;
  --color-primary-700: #2541b7;
  --color-primary-800: #1a3293;
  --color-primary-900: #132878;
  --color-primary-950: #0c1b5c;

  /* 中性色调 */
  --color-gray-50: #f8fafc;
  --color-gray-100: #f1f5f9;
  --color-gray-200: #e2e8f0;
  --color-gray-300: #cbd5e1;
  --color-gray-400: #94a3b8;
  --color-gray-500: #64748b;
  --color-gray-600: #475569;
  --color-gray-700: #334155;
  --color-gray-800: #1e293b;
  --color-gray-900: #0f172a;
  --color-gray-950: #020617;

  /* 深色模式颜色 */
  --color-dark-bg: #0f172a;
  --color-dark-surface: #1e293b;
  --color-dark-card: #334155;
  --color-dark-border: #475569;
  --color-dark-text: #e2e8f0;
  --color-dark-text-secondary: #94a3b8;
  
  /* 滚动条颜色变量 */
  --scrollbar-track: #f1f5f9;
  --scrollbar-thumb: #94a3b8;
  --scrollbar-thumb-hover: #64748b;
  --scrollbar-dark-track: #1e293b;
  --scrollbar-dark-thumb: #475569;
  --scrollbar-dark-thumb-hover: #64748b;
}

/* 深色模式样式 */
[data-theme='dark'] {
  --bg-primary: var(--color-dark-bg);
  --bg-secondary: var(--color-dark-surface);
  --text-primary: var(--color-dark-text);
  --text-secondary: var(--color-dark-text-secondary);
  --border-color: var(--color-dark-border);
  
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

/* 自定义滚动条样式 - 适用于所有浏览器 */
/* 滚动条基础样式 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

/* 滚动条轨道 */
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 8px;
}

/* 滚动条滑块 */
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 8px;
  border: 2px solid var(--scrollbar-track);
  transition: background-color 0.2s ease;
}

/* 滚动条滑块悬停 */
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* 滚动条角落 */
::-webkit-scrollbar-corner {
  background: var(--scrollbar-track);
}

/* 深色模式滚动条样式 */
[data-theme='dark'] ::-webkit-scrollbar-track {
  background: var(--scrollbar-dark-track);
}

[data-theme='dark'] ::-webkit-scrollbar-thumb {
  background: var(--scrollbar-dark-thumb);
  border: 2px solid var(--scrollbar-dark-track);
}

[data-theme='dark'] ::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-dark-thumb-hover);
}

[data-theme='dark'] ::-webkit-scrollbar-corner {
  background: var(--scrollbar-dark-track);
}

/* Firefox 滚动条样式 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

[data-theme='dark'] * {
  scrollbar-color: var(--scrollbar-dark-thumb) var(--scrollbar-dark-track);
}

/* 统一的文章卡片样式 - 纯CSS实现 */
.article-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.25rem;
  border: 1px solid var(--color-gray-200);
  border-radius: 0.75rem;
  background-color: white;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.article-card:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  transform: translateY(-0.25rem);
}

/* 黑暗模式卡片样式 */
[data-theme='dark'] .article-card {
  background-color: var(--color-gray-800);
  border-color: var(--color-gray-700);
}

.article-card-link {
  display: block;
  flex-grow: 1;
}

.article-card-content {
  display: flex;
  align-items: flex-start;
}

.article-card-icon {
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background-color: var(--color-primary-100);
  color: var(--color-primary-600);
}

[data-theme='dark'] .article-card-icon {
  background-color: rgba(75, 107, 255, 0.2);
  color: var(--color-primary-400);
}

.article-card:hover .article-card-icon {
  background-color: var(--color-primary-200);
}

[data-theme='dark'] .article-card:hover .article-card-icon {
  background-color: rgba(75, 107, 255, 0.3);
}

.article-card-body {
  margin-left: 0.75rem;
  flex: 1;
  min-width: 0;
}

.article-card-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-gray-800);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

[data-theme='dark'] .article-card-title {
  color: var(--color-gray-100);
}

.article-card:hover .article-card-title {
  color: var(--color-primary-700);
}

[data-theme='dark'] .article-card:hover .article-card-title {
  color: var(--color-primary-300);
}

.article-card-summary {
  font-size: 0.75rem;
  color: var(--color-gray-600);
  margin-top: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

[data-theme='dark'] .article-card-summary {
  color: var(--color-gray-400);
}

.article-card-footer {
  font-size: 0.75rem;
  color: var(--color-gray-500);
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.article-card-date {
  color: var(--color-gray-500);
}

[data-theme='dark'] .article-card-date {
  color: var(--color-gray-400);
}

.article-card-read-more {
  color: var(--color-primary-600);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: 0.5rem;
}

[data-theme='dark'] .article-card-read-more {
  color: var(--color-primary-400);
}

/* 打字机效果样式 */
.typewriter-container {
  position: relative;
}

.typewriter-cursor {
  position: absolute;
  right: -2px;
  animation: typewriter-blink 1s infinite;
  color: currentColor;
}

@keyframes typewriter-blink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}